home *** CD-ROM | disk | FTP | other *** search
/ PCMania 84 / PCMania CD84_1.iso / guiacompras / JS / jsFont.js next >
Text File  |  1999-06-02  |  990b  |  59 lines

  1. /*  
  2.  *  Objeto: jsFont
  3.  *  
  4.  *  Javascript v1.0 - Compatibilidad: IE4 y NS4 
  5.  *  Programado por LAGOR [15/02/1999]
  6.  *
  7.  *  HOBBYPRESS S.A. 
  8.  *  Todos los derechos de esta fuente estßn reservados.
  9.  */
  10.  
  11. function jsFont(doc,url)
  12. {
  13.     this.url=url;
  14.     this.doc=doc;
  15.     this.hSpace=0;
  16.     this.vSpace=0;
  17.     this.wd=0;
  18.     this.hg=0;
  19.     this.put=jsFont_Put;
  20. }
  21.  
  22. function jsFont_Put(text,max)
  23. {
  24.     var f=0,ch='',len=0;
  25.     for(f=0;f<text.length;f++)
  26.     {
  27.         ch=text.charAt(f);
  28.         switch(ch)
  29.         {
  30.         case '+':
  31.             if (len>=max)
  32.             {
  33.                 this.doc.write('<BR>');
  34.                 len=0;
  35.                 continue;
  36.             }
  37.             else 
  38.             {
  39.                 ch='c20';
  40.                 len++;
  41.             }
  42.             break;
  43.         case '%':
  44.             ch='c'+text.charAt(++f)+text.charAt(++f);
  45.             break;
  46.         case '\n':
  47.             this.doc.write('<BR>');
  48.             continue;
  49.         }
  50.         this.doc.write('<IMG BORDER=0'+
  51.             (this.hSpace>0? ' HSPACE='+this.hSpace:'')+
  52.             (this.vSpace>0? ' VSPACE='+this.vSpace:'')+
  53.             (this.wd>0? ' WIDTH='+this.wd:'')+
  54.             (this.hg>0? ' HEIGHT='+this.hg:'')+
  55.             ' SRC="'+this.url+ch+'.gif">');
  56.         len++;
  57.     }
  58. }
  59.